<?php
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/fingerprint.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/jquery-1.10.1.min.js",CClientScript::POS_HEAD);
//Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);


Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.core.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.scroller.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.util.datetime.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.datetimebase.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.widget.ios.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/frontend/mobiscroll/js/mobiscroll.i18n.zh.js",CClientScript::POS_HEAD);


Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/global.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/index.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/Font-Awesome-3.2.1/css/font-awesome.min.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/bootstrap.min.css");

Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/app.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/sweetalert.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/demo.css");
Yii::app()->clientScript->registerCssFile($this->staticsPath."/css/lrtk.css");
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/alert.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/jquery.imgbox.pack.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/js_mobile_common_new.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/sweetalert.min.js",CClientScript::POS_HEAD);
Yii::app()->clientScript->registerScriptFile($this->staticsPath."/js/demo.js",CClientScript::POS_HEAD);
?>
 <style type="text/css">
        * {cursor: pointer;}
        .weui_mask_transition {
            display: none;
            position: fixed;
            z-index: 1;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            background: rgba(0, 0, 0, 0);
            -webkit-transition: background .3s;
            transition: background .3s;
        }
        .weui_fade_toggle {
            background: rgba(0, 0, 0, 0.6);
        }
        .weui_actionsheet {
            position: fixed;
            left: 0;
            bottom: 0;
            -webkit-transform: translate(0, 100%);
            -ms-transform: translate(0, 100%);
            transform: translate(0, 100%);
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            z-index: 2;
            width: 100%;
            background-color: #EFEFF4;
            -webkit-transition: -webkit-transform .3s;
            transition: transform .3s;
        }
        .weui_actionsheet_toggle {
            -webkit-transform: translate(0, 0);
            -ms-transform: translate(0, 0);
            transform: translate(0, 0);
        }
        .weui_actionsheet_menu {
            background-color: #FFFFFF;
        }
        .weui_actionsheet_cell:before {
            content: " ";
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 1px;
            border-top: 1px solid #D9D9D9;
            -webkit-transform-origin: 0 0;
            -ms-transform-origin: 0 0;
            transform-origin: 0 0;
            -webkit-transform: scaleY(0.5);
            -ms-transform: scaleY(0.5);
            transform: scaleY(0.5);
        }
        .weui_actionsheet_cell:first-child:before {
            display: none;
        }
        .weui_actionsheet_cell {
            position: relative;
            padding: 10px 0;
            text-align: center;
            font-size: 18px;
        }
        .weui_actionsheet_cell.title {
            color: #999;
        }
        .weui_actionsheet_action {
            margin-top: 6px;
            background-color: #FFFFFF;
        }

    </style>
<div id="actionSheet_wrap">
    
    <div class="weui_actionsheet" id="weui_actionsheet">
        <div class="weui_actionsheet_menu">
            <div class="weui_actionsheet_cell play_pyq" id="div_zan">点赞</div>
            <div class="weui_actionsheet_cell play_pyq" id="div_comment">发表评论</div>
             <?php   if($type=='1') {?>
             <div class="weui_actionsheet_cell play_pyq" id="div_del">删除</div>
             <?php }?>
        </div>

    </div>
</div>
   
    <header class="homeHder header" style="background-color: #1CB0EC;">
<!--        <a href="--><?php //echo Yii::app()->createUrl('user/index',array('openid'=>$openid)) ?><!--">-->
<!--        <div class="hder_return flol">-->
<!---->
<!--                <i class="size fa fa-angle-left"></i>-->
<!---->
<!--        </div>-->
<!--        </a>-->
         <a  style="font-size:15px;margin-left:10px;float:left;width:50px;" href="<?php echo $this->createUrl('member',array('type'=>$type)) ?>">返回</a>
        <div class="hder_logo">   <?php echo $ptitle ?></div>
         <?php   if($type=='2') {?>
            <a id="zs" style="font-size:15px;margin-right:10px;float:right;width:50px;" href="#">搜索</a>
             <?php }?>
        
    </header>
    <section class="wrap" id="section_id" style="display:none;">
    <div class="container-fluid">
    <div class="row">

        <!-- Modal -->
        <div aria-hidden="true" aria-labelledby="linkModalLabel" role="dialog" tabindex="-1" id="linkModal-a">
            <div class="modal-body">
                <form>

                    <div class="col-lg-6" style="margin-bottom: 6px">

                        <select class="form-control" id="s_gid" name="s_gid">
                            <option selected="selected" value="">请选择年级</option>
                            <?php if($grade_info){ ?>
                                <?php foreach($grade_info as $v){ ?>
                                    <option value="<?php echo  $v['id'] ?>"><?php echo  $v['title'] ?></option>
                                <?php } ?>
                            <?php } ?>
                        </select>
                    </div>
                    <div class="col-lg-6"  style="margin-bottom: 6px">
                        <select class="form-control"  id="s_cid" name="s_cid">
                            <option value="">请选择班级</option>
                        </select>
                    </div>
                    <div class="col-lg-6">
                        <div class="input-group">
                            <input type="text" id="pname" name="pname" class="form-control" placeholder="学生姓名">
      <span class="input-group-btn">
        <button class="btn btn-default" id="submitform" type="button">搜索</button>
      </span>
                        </div>
                    </div>
                </form>





            </div>
        </div>

    </div>
    </div>

    <div class="container-fluid">
        <div class="row">
            <div style="margin:20px auto;text-align: center;">
                <div class="btn-group" >
                    <label id="order_new"  class="Ckey btn btn-primary active">
                        按时间
                    </label>
                    <label id="order_zan" class="Ckey btn btn-primary">
                        按点赞
                    </label>
                </div>
            </div>
        </div>
    </div>
    <input type="hidden" id="Ckey" value="1">
</section>
<div id="main" style="background-color:white;">
    <div id="list">
        <ul>
             <?php 
                if($newlist){
             foreach($newlist as $v){ ?>
            <li>
                <div class="po-avt-wrap">
                    <img class="po-avt data-avt"  src="<?php echo $v['userinfo']['image'] ?>">
                </div>
                <div class="po-cmt">
                    <div class="po-hd">
                        <p class="po-name"><span class="data-name"><?php echo $v['userinfo']['user_name'] ?>-《<?php echo $v['opus']['opus_title'] ?>》</span></p>
                        <div class="post">
                            <p><?php echo $v['opus']['opus_desc'] ?></p>
                            <p>
                             <?php foreach($v['opuslist'] as $vv){ ?>
                              <a class="a_img" href="<?php echo Yii::app()->request->hostInfo ?>/<?php echo $vv['opus_path'] ?>">
                                 <img class="list-img" src="<?php echo Yii::app()->request->hostInfo ?>/<?php echo $vv['opus_path'] ?>" style="height: 80px;">
                             </a>
                             <?php } ?>
                            </p>
                        </div>
                        <p class="time"><?php echo $v['opus']['create_time'] ?></p><img id="<?php echo $v['opus']['id'] ?>" class="c-icon" src="<?php echo $this->staticsPath."/img/c.png" ?>">
                    </div>
                    <div class="r"></div>
                    <div class="cmt-wrap">
                        <div class="like"><img src="<?php echo $this->staticsPath."/img/l.png" ?>">
                         <?php foreach($v['zanlist'] as $vvv){ echo $vvv['user_name']   ?>  <?php } ?></div>
                        <div class="cmt-list">
                         <?php foreach($v['commentlist'] as $vvvv){ ?>
                          <p><span><?php echo $vvvv['user_name'] ?>：</span><?php echo $vvvv['content'] ?> </p>
                         <?php } ?>
                        </div>
                    </div>
                </div>
            </li>
           <?php }} ?>
        </ul>
    </div>


</div>
<script>
</script>


<script>
var opusid ="";
$(function(){
	$(".a_img").each(function(){
		$(this).imgbox({
			'speedIn'		: 0,
			'speedOut'		: 0,
			'alignment'		: 'center',
			'overlayShow'	: true,
			'allowMultiple'	: false
		});
	});
	
    $("#s_gid").change(function() {
        loadClass($("#s_gid").val());
    });

    function loadClass(gid) {
        $.ajax({
            url: '<?php echo Yii::app()->createAbsoluteUrl("index/loadClass"); ?>'+ 'gid/' +gid,
            type: 'POST',
            dataType: 'html',
            success: function(msg) {
                $("#s_cid").html(msg);
            }
        });
    }
});
    function gotoplay(scene) {
        var gourl = "/act/pengYouQuan/my.php?sv=" + scene;
        location.href = gourl;
    }
    function safetostring(str) {
        return String(str).replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'");
    }

    //$("#list").html($("#scene").html());

    setTimeout(function () {
        // $(".data-name").text(safetostring(nickname));
        //$(".data-avt").attr("src", headimgurl);
        var cw = $('.list-img').width();
        $('.list-img').css({'height': cw + 'px'});
    }, 0);

    $(window).resize(function () {
        var cw = $('.list-img').width();
        $('.list-img').css({'height': cw + 'px'});
    });


    $(document.body).show();


    function hideActionSheet(weuiActionsheet, mask) {
        weuiActionsheet.removeClass('weui_actionsheet_toggle');
        mask.removeClass('weui_fade_toggle');
        weuiActionsheet.on('transitionend', function () {
            mask.hide();
        }).on('webkitTransitionEnd', function () {
            mask.hide();
        })
    }
    function showActionSheet() {
        var mask = $('#mask');
        var weuiActionsheet = $('#weui_actionsheet');
        weuiActionsheet.addClass('weui_actionsheet_toggle');
        mask.show().addClass('weui_fade_toggle').click(function () {
            hideActionSheet(weuiActionsheet, mask);
        });
        $('#actionsheet_cancel').click(function () {
            hideActionSheet(weuiActionsheet, mask);
        });
        weuiActionsheet.unbind('transitionend').unbind('webkitTransitionEnd');
    }


    $(".c-icon").bind("click",function(){
        opusid = $(this).attr("id");
      
        showActionSheet();
     });
    $("#div_zan").bind("click",function(){
    	$.ajax({
            url:'<?php echo $this->createUrl('AjaxProductionZan') ?>',
            type : 'GET',
            dataType:'json',
            data:{'oid':opusid
             },
            success : function (data,response,status) {
            	swal({   title: data.message,  
                  	 text:"",   
                  	 type: "info",   
                  	 showCancelButton: false,  
                  	  confirmButtonColor: "#DD6B55",  
                  	   confirmButtonText: "确定"}, 
                  	   function(){   
                  		 window.location.reload(true);
                      	    });
            }
        });
     });
    $("#div_comment").bind("click",function(){
    	swal({   title: '评论',  
         	 text:"<textarea id='pl_content' style='width:90%;margin-left:auto;margin-right:auto;height:100px;border:1px solid #DDDDDD;' placeholder='填写评论'></textarea>",   
         	 type: "",  
         	 html:true, 
         	 showCancelButton: true,  
         	cancelButtonText: "取消",
       	  confirmButtonColor: "#DD6B55",  
         	  confirmButtonColor: "#DD6B55",  
         	   confirmButtonText: "确定",
         		  closeOnConfirm: false}, 
         	   function(){   
         		  $.ajax({
         	            url:'<?php echo $this->createUrl('AjaxProductionPl') ?>',
         	            type : 'GET',
         	            dataType:'json',
         	            data:{'oid':opusid,'content':$("#pl_content").val()
         	             },
         	            success : function (data,response,status) {
         	            	swal({   title: data.message,  
         	                  	 text:"",   
         	                  	 type: "info",   
         	                  	 showCancelButton: false,  
         	                  	  confirmButtonColor: "#DD6B55",  
         	                  	   confirmButtonText: "确定"}, 
         	                  	   function(){   
         	                  		 window.location.reload(true);
         	                      	    });
         	            }
         	        });
             	    });
     });
    $("#submitform").bind("click",function(){
    	 var gid = $("#s_gid").val();
         var cid = $("#s_cid").val();
         var pid = $("#pname").val();



         window.location.href='<?php echo $this->createUrl('opusList') ?>gid/'+gid+'/pname/'+pid+'/orderby/zan/cid/'+cid+'/type/'+<?php echo$type ?>;
     });
     $("#div_del").bind("click",function(){
     	$.ajax({
             url:'<?php echo $this->createUrl('AjaxProductionDel') ?>',
             type : 'GET',
             data:{'oid':opusid
             },
             dataType:'json',
             success : function (data,response,status) {
                 
            	 swal({title: data.message,  
                  	 text:"",   
                  	 type: "info",   
                  	 showCancelButton: false,  
                  	  confirmButtonColor: "#DD6B55",  
                  	   confirmButtonText: "确定"}, 
                  	   function(){   
                  		 window.location.reload(true);
                      	    });
             }
         });
      });
      $("#order_new").bind("click",function(){
          var gid = $("#s_gid").val();
          var cid = $("#s_cid").val();
          var pid = $("#pname").val();
          window.location.href='<?php echo $this->createUrl('opusList') ?>gid/'+gid+'/pname/'+pid+'/orderby/new/cid/'+cid+'/type/'+<?php echo$type ?>;

       });
       $("#order_zan").bind("click",function(){
    	   var gid = $("#s_gid").val();
           var cid = $("#s_cid").val();
           var pid = $("#pname").val();
           window.location.href='<?php echo $this->createUrl('opusList') ?>gid/'+gid+'/pname/'+pid+'/orderby/zan/cid/'+cid+'/type/'+<?php echo$type ?>;
        });
       $("#zs").bind("click",function(){
           if($("#zs").text()=='隐藏'){
               $("#section_id").hide();
               $("#zs").html("筛选");
           }else{
        	   $("#section_id").show();
               $("#zs").html("隐藏");
           }
           
       });
</script>